package com.itheima.function;

import java.util.Arrays;

public class FunctionDemo1 {
    public static void main(String[] args) {
        Integer[] arr = {3,5,4,1,2};
       /*
        Arrays.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1-o2;
            }
        });*/

        Arrays.sort(arr,FunctionDemo1::substraction);

        System.out.println(Arrays.toString(arr));
    }
    public static int substraction(Integer n1,Integer n2){
        return n1-n2;
    }
}
